<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<a href="index.html">返回</a>
<h2>浏览器的本地存储</h2>
<div class="app">
  <button onclick="save()">保存</button>
  <button onclick="read()">读取</button>
  <button onclick="removes()">删除</button>
</div>
<script>
    const stu={name:"zhang",age:30}
    function save(){
      localStorage.setItem("stu",JSON.stringify(stu))
      localStorage.setItem("a","aaaa")
      localStorage.setItem("b",32)
    }
    function read(){
      console.log( localStorage.getItem("a"))
      console.log( localStorage.getItem("b"))
      console.log(
        JSON.parse(
          localStorage.getItem("stu")) )
    }
    function removes(){
      console.log( localStorage.removeItem("a"))
      console.log( localStorage.removeItem("b"))
    }
</script>
</body>
</html>
